package com.xjrsoft.module.organization.controller;

import cn.hutool.core.bean.BeanUtil;
import cn.hutool.core.util.ObjectUtil;
import cn.hutool.core.util.StrUtil;
import com.baomidou.mybatisplus.core.metadata.IPage;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.github.yulichang.toolkit.MPJWrappers;
import com.xjrsoft.common.annotation.XjrLog;
import com.xjrsoft.common.constant.GlobalConstant;
import com.xjrsoft.common.model.result.R;
import com.xjrsoft.common.page.ConventPage;
import com.xjrsoft.common.utils.VoToColumnUtil;
import com.xjrsoft.module.erpModel.caseErpDevice.entity.CaseErpDeviceInfo;
import com.xjrsoft.module.erpModel.caseErpDevice.vo.CaseErpDeviceInfoVo;
import com.xjrsoft.module.erpModel.caseErpSupplier.entity.CaseErpSupplier;
import com.xjrsoft.module.organization.dto.UpdateApprovalSpecialListDto;
import com.xjrsoft.module.organization.dto.UpdateDepartmentApprovalUserDto;
import com.xjrsoft.module.organization.entity.ApprovalSpecialist;
import com.xjrsoft.module.organization.entity.DepartmentApprovalUser;
import com.xjrsoft.module.organization.entity.User;
import com.xjrsoft.module.organization.service.IDepartmentApprovalUserService;
import com.xjrsoft.module.organization.vo.ApprovalSpecialistVo;
import com.xjrsoft.module.organization.vo.DepartmentApprovalUserVo;
import com.xjrsoft.module.organization.vo.UserVo;
import com.xjrsoft.module.system.entity.DictionaryDetail;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import lombok.AllArgsConstructor;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;
import java.util.List;
import java.util.stream.Collectors;

/**
 * <p>
 * 部门审批专员人员表 前端控制器
 * </p>
 *
 * @author hnyyzy
 * @since 2024-03-07
 */
@RestController
@RequestMapping(GlobalConstant.ORGANIZATION_MODULE_PREFIX +"/departmentApprovalUser")
@Api(value = GlobalConstant.ORGANIZATION_MODULE_PREFIX +"/departmentApprovalUser", tags = "部门审批专员人员")
@AllArgsConstructor
public class DepartmentApprovalUserController {
    private final IDepartmentApprovalUserService departmentApprovalUserService;


    @PutMapping
    @ApiOperation(value = "修改部门审批专员人员")
    @XjrLog(value = "修改部门审批专员人员")
    public R update(@Valid @RequestBody List<UpdateDepartmentApprovalUserDto> updateDepartmentApprovalUserDtos) {
        //新增或者编辑部门审批专员人员
        List<DepartmentApprovalUser> departmentApprovalUsers = BeanUtil.copyToList(updateDepartmentApprovalUserDtos, DepartmentApprovalUser.class);
        departmentApprovalUserService.saveOrUpdateBatch(departmentApprovalUsers);
        return R.ok();
    }


}
